/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */
#ifndef NCSI_OVER_MCTP_MELLANOX_H
#define NCSI_OVER_MCTP_MELLANOX_H

#include <mctp/mctp.h>
#include <ncsi/ncsi_mellanox.h>
#include <ncsi_over_mctp/ncsi_over_mctp.h>
#include <ncsi_over_mctp/ncsi_over_mctp_standard.h>

const uint8_t MELLANOX_OEM_COMMAND_REV_ID = 0x00;

namespace dev {
// 厂商ID
#define MELLANOX_MANUFACTURE_ID_REP     0x19810000

#define ENABLE_LLDP 1
#define DISABLE_LLDP 0

#define MELLANOX_COMMON_DATA(cmd_id, parameter, optional_data)                      \
        {0x00, 0x00, 0x81, 0x19, MELLANOX_OEM_COMMAND_REV_ID, cmd_id, parameter, optional_data}
#define MELLANOX_COMMON_DATA_SIZE 8

typedef struct ncsi_bdf_info {
    uint8_t bus;
    uint8_t device;
    uint8_t function;
} ncsi_bdf_info_t;

typedef struct ncsi_temp_info {
    uint8_t max_operating_temp;
    uint8_t cur_temp;
} ncsi_temp_info_t;

class MC_API ncsi_over_mctp_mellanox : public ncsi_over_mctp_standard {
public:
    ncsi_over_mctp_mellanox(mctp& mctp_obj) : ncsi_over_mctp_standard(mctp_obj) {};

    bool get_temp_info(uint8_t package_id, uint8_t channel_id,  uint8_t temp_type, ncsi_temp_info_t *temp_info);
    bool get_mac_addr(uint8_t package_id, uint8_t channel_id, uint8_t *mac_addr, uint8_t len);
    bool get_default_mac_addr(uint8_t package_id, uint8_t channel_id, uint8_t *mac_addr, uint8_t len);
    bool reset_nic(uint8_t package_id, uint8_t channel_id);
    bool get_lldp_capability(uint8_t package_id, uint8_t channel_id, uint8_t *lldp_capability);
    bool set_lldp_capability(uint8_t package_id, uint8_t channel_id, uint8_t lldp_capability);

};

} // namespace dev
#endif // NCSI_OVER_MCTP_MELLANOX_H
